package com.onefish.toolkit;

import com.google.common.util.concurrent.RateLimiter;

import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.TimeUnit;


/**
 * google guava RateLimiter use
 *
 * @author onefish
 * @date 2024-06-06
 */
public class RateLimiters {
    // 特定限流策略限流
    public static final ConcurrentHashMap<String,RateLimiter> USER_RATE_LIMITER = new ConcurrentHashMap<>();
    // 全局限流策略限流
    public static final RateLimiter RATE_LIMITER = RateLimiter.create(0.5,1, TimeUnit.SECONDS);
}
